package org.kazuhiko.rpg.server.task.tasks;

import org.apache.mina.core.session.IoSession;
import org.kazuhiko.rpg.server.net.RPGSession;
import org.kazuhiko.rpg.server.task.Task;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class SessionOpenedTask implements Task
{
	private final static Logger logger = LoggerFactory.getLogger( SessionOpenedTask.class );
	
	private final IoSession session;
	
	public SessionOpenedTask( IoSession session )
	{
		this.session = session;
	}
	
	@Override
	public void execute()
	{
		logger.info( "Session with {} openend.", session.getRemoteAddress() );
		session.setAttribute( "attachment", new RPGSession( session ) );
	}
}
